from flask import Blueprint, request
from ..controllers.signup_record import create_signup_record, get_signup_records, get_signup_record, update_signup_record, delete_signup_record

# 创建报名记录管理蓝图
signup_record_bp = Blueprint("signup_records", __name__, url_prefix="/signup_records")

# 报名记录管理路由
# 创建报名记录
@signup_record_bp.route("/add", methods=["POST"])
def route_create_signup_record():
    data = request.get_json() or {}
    return create_signup_record(data)

# 获取报名记录列表
@signup_record_bp.route("/list", methods=["GET"])
def route_get_signup_records():
    data = request.args.to_dict() or {}
    return get_signup_records(data)

# 获取单个报名记录信息
@signup_record_bp.route("/record", methods=["GET"])
def route_get_signup_record():
    data = request.args.to_dict() or {}
    return get_signup_record(data)

# 更新报名记录信息
@signup_record_bp.route("/edit", methods=["POST"])
def route_update_signup_record():
    data = request.get_json() or {}
    return update_signup_record(data)

# 删除报名记录
@signup_record_bp.route("/delete", methods=["POST"])
def route_delete_signup_record():
    data = request.get_json() or {}
    return delete_signup_record(data)